//package com.jcj.jcjgateway;
//
//import org.springframework.http.ResponseEntity;
//import org.springframework.stereotype.Component;
//import org.springframework.web.reactive.function.client.WebClient;
//import org.springframework.web.reactive.function.server.ServerRequest;
//import org.springframework.web.reactive.function.server.ServerResponse;
//import reactor.core.publisher.Mono;
//
//@Component
//public class HelloHandler {
//
//    Mono<ServerResponse> handle(ServerRequest request) {
//        String url = "http://localhost:8081/jcjrpc";
//        String requestJson = """
//                {
//                    "service":"com.jcj.jcjrpc.demo.api.UserService",
//                    "methodSign":"findById@1_int",
//                    "args":[100]
//                }
//                """;
//
//        WebClient client = WebClient.create(url);
//        Mono<ResponseEntity<String>> entity = client.post()
//                .header("Content-Type", "application/json")
//                .bodyValue(requestJson)
//                .retrieve().toEntity(String.class);
//
//        Mono<String> body = entity.map(ResponseEntity::getBody);
//        body.subscribe(d -> System.out.println(d));
//        return ServerResponse.ok()
//                .header("Content-Type", "application/json")
//                .header("jcj.gw.version", "V1.2.3")
//                .body(body, String.class);
//    }
//
//}
